package com.gxa.worker.recycling.controller;

import com.gxa.core.recycling.anno.NeedToken;
import com.gxa.core.recycling.common.JsonResult;
import com.gxa.worker.recycling.service.GoodsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author ：looker
 * @date ：Created in 2021/12/3 9:41
 */
@CrossOrigin
@RestController
@RequestMapping("/goods")
@Api("商品业务接口")
public class GoodsController {

    @Autowired
    GoodsService goodsService;

    /**
     * 杨述波
     * @return
     */
    @NeedToken
    @PostMapping("/getAll")
    @ApiOperation("/查询全部兑换商品信息")
    public Map selectByDelivered(){
        List<Map<String, Object>> all = goodsService.getAll();
        JsonResult jsonResult = new JsonResult();
        jsonResult.setCode("200");
        jsonResult.setData(all);
        return jsonResult.getDataMap();
    }
}
